package com.cta.utils;

import org.springframework.security.core.context.SecurityContextHolder;

import com.cta.constant.ROLE;
import com.cta.entity.Contact;

public class RequestUtils {

	public static boolean isSuperAdmin() {
		Contact user = (Contact) SecurityContextHolder.getContext()
				.getAuthentication().getPrincipal();
		if (user.getRole().getRole() == ROLE.SUPER_ADMIN) {
			return true;
		}
		return false;
	}

	public static boolean isAdmin(Contact user) {
		if (user.getRole().getRole() == ROLE.ADMIN) {
			return true;
		}
		return false;
	}

	public static boolean isNormalUser(Contact user) {
		if (user.getRole().getRole() == ROLE.CONTACT) {
			return true;
		}
		return false;
	}
}
